From 6c149f03a459a28c26a305444172b164388af502 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Sat, 19 Nov 2016 19:22:10 +0100 Subject: [PATCH] remove babl-fish-stats --- TODO | 7 +- babl/Makefile.am | 1 - babl/babl-fish-stats.c | 433 ----------------------------------- babl/babl-internal.h | 1 - babl/babl.c | 12 - tests/Makefile.am | 1 - tests/babl_fish_path_dhtml.c | 15 -- 7 files changed, 2 insertions(+), 468 deletions(-) delete mode 100644 babl/babl-fish-stats.c delete mode 100644 tests/babl_fish_path_dhtml.c diff --git a/TODO b/TODO index 1c5aefc..6707b94 100644 --- a/TODO +++ b/TODO @@ -3,11 +3,8 @@ diff --git a/babl/Makefile.am b/babl/Makefile.am index 0f5526d..096f6b7 100644 --- a/babl/Makefile.am +++ b/babl/Makefile.am @@ -17,7 +17,6 @@ c_sources = \ babl-fish-path.c \ babl-fish-reference.c \ babl-fish-simple.c \ - babl-fish-stats.c \ babl-fish.c \ babl-format.c \ babl-hash-table.c \ diff --git a/babl/babl-fish-stats.c b/babl/babl-fish-stats.c deleted file mode 100644 index 2b9cc7c..0000000 --- a/babl/babl-fish-stats.c +++ /dev/null @@ -1,433 +0,0 @@ -/* babl - dynamically extendable universal pixel fish library. - * Copyright (C) 2005, Øyvind KolÃ¥s. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see - * . - */ - -#include "config.h" -#include "babl-internal.h" - -static FILE *output_file = NULL; -static int qux = 0; - -static char *utf8_bar[] = { " ", "·", "▁", "▂", "▃", "▄", "▅", "▆", "▇", "█" }; -/* -static char *utf8_bar[]= {"!","▁","▃","▅","▇","█","!","!","!"}; -static char *utf8_bar[]={"·", "█", "▇", "▆", "▅", "▄", "▃", "▂", "▁", }; -static char *utf8_bar[]={" ","1","2","3","4","5","6","7","8"}; -*/ - -static double sum_pixels = 0.0; - -static int -table_destination_sum_each (Babl *babl, - void *userdata) -{ - const Babl *source = userdata; - const Babl *destination = babl; - - if (source != destination) - { - const Babl *fish = babl_fish (source, destination); - babl_assert (fish); - sum_pixels += fish->fish.pixels; - } - return 0; -} - -static int -table_source_sum_each (Babl *babl, - void *userdata) -{ - babl_format_class_for_each (table_destination_sum_each, babl); - return 0; -} - -static void -table_sum_processings_calc (void) -{ - sum_pixels = 0; - babl_format_class_for_each (table_source_sum_each, NULL); -} - -#define LIMIT 0.03 - -static int -table_destination_each (Babl *babl, - void *userdata) -{ - Babl *source = userdata; - Babl *destination = babl; - - qux++; - if (qux % babl_formats_count () == qux / babl_formats_count ()) - fprintf (output_file, " "); - else - { - const Babl *fish = babl_fish (source, destination); - - babl_assert (fish); - - - switch (fish->class_type) - { - case BABL_FISH_PATH: - - fprintf (output_file, "%s", - fish->fish.pixels / sum_pixels > LIMIT ? " style='background-color: #69f'" : "", - utf8_bar[babl_list_size (fish->fish_path.conversion_list)]); - - { - int i; - fprintf (output_file, "
"); - fprintf (output_file, "

path %s to %s

", source->instance.name, destination->instance.name); - if (fish->fish.processings > 0) - { - fprintf (output_file, "Processings:%i
", fish->fish.processings); - fprintf (output_file, "Pixels:%li
", fish->fish.pixels); - } - fprintf (output_file, "\n"); - - fprintf (output_file, ""); - fprintf (output_file, ""); - fprintf (output_file, ""); - fprintf (output_file, ""); - fprintf (output_file, ""); - - for (i = 0; i < babl_list_size (fish->fish_path.conversion_list); i++) - { - fprintf (output_file, ""); - fprintf (output_file, "", BABL (fish->fish_path.conversion_list->items[i])->instance.name); - fprintf (output_file, "", - babl_conversion_cost (&BABL (fish->fish_path.conversion_list->items[i])->conversion)); - fprintf (output_file, "", - babl_conversion_error (&BABL (fish->fish_path.conversion_list->items[i])->conversion)); - fprintf (output_file, ""); - } - - fprintf (output_file, ""); - fprintf (output_file, ""); - fprintf (output_file, "", fish->fish_path.cost); - fprintf (output_file, "", fish->fish.error); - fprintf (output_file, ""); - fprintf (output_file, "
conversioncosterror
%s%li%e
total%3.0f%e
"); - fprintf (output_file, "
"); - } - fprintf (output_file, "
\n"); - break; - - case BABL_FISH_REFERENCE: - fprintf (output_file, " ", - fish->fish.pixels / sum_pixels > LIMIT ? " style='background-color: #f99'" : ""); - fprintf (output_file, "
"); - fprintf (output_file, "

Reference %s to %s

", source->instance.name, destination->instance.name); - - if (fish->fish.processings > 1) - { - fprintf (output_file, "Processings:%i
", fish->fish.processings); - fprintf (output_file, "Pixels:%li
", fish->fish.pixels); - } - fprintf (output_file, "
"); - fprintf (output_file, "
\n"); - break; - - case BABL_FISH_SIMPLE: - fprintf (output_file, "·", - fish->fish.pixels / sum_pixels > LIMIT ? " style='background-color: #69f'" : ""); - fprintf (output_file, "
"); - fprintf (output_file, "

Simple %s to %s

", source->instance.name, destination->instance.name); - - - fprintf (output_file, "%s
", BABL (fish->fish_simple.conversion)->instance.name); - fprintf (output_file, "cost: %li
", babl_conversion_cost ((fish->fish_simple.conversion))); - fprintf (output_file, "error: %e
", babl_conversion_error ((fish->fish_simple.conversion))); - - if (fish->fish.processings > 0) - { - fprintf (output_file, "Processings:%i
", fish->fish.processings); - fprintf (output_file, "Pixels:%li
", fish->fish.pixels); - } - fprintf (output_file, "
"); - fprintf (output_file, "
\n"); - break; - - default: - babl_fatal ("Unknown fish type"); - break; - } - } - return 0; -} - -static int source_no = 0; - - - -static int -table_source_each (Babl *babl, - void *userdata) -{ - char expanded_name[512]; - const char *s; - char *d; - - s = babl->instance.name; - d = &expanded_name[0]; - - while (*s) - { - switch (*s) - { - case ' ': - *(d++) = '&'; - *(d++) = 'n'; - *(d++) = 'b'; - *(d++) = 's'; - *(d++) = 'p'; - *(d++) = ';'; - *(d) = '\0'; - s++; - break; - - default: - *(d++) = *(s++); - *(d) = '\0'; - break; - } - } - - fprintf (output_file, ""); - fprintf (output_file, "%s", expanded_name); - { - int i; - - fprintf (output_file, "
", babl); - fprintf (output_file, "

%s

", babl->instance.name); - - fprintf (output_file, "
"); - fprintf (output_file, "
bytes/pixel
%i
", babl->format.bytes_per_pixel); - fprintf (output_file, "
model
%s
", BABL (babl->format.model)->instance.name); - fprintf (output_file, "
loss
%f
", babl_format_loss (babl)); - fprintf (output_file, "
planar
%d
", babl->format.planar); - fprintf (output_file, "
components
"); - - for (i = 0; i < babl->format.components; i++) - { - fprintf (output_file, "", - BABL (babl->format.type[i])->instance.name, - BABL (babl->format.component[i])->instance.name); - } - fprintf (output_file, "
%s%s
"); - - fprintf (output_file, "
\n"); - } - - fprintf (output_file, "
"); - babl_format_class_for_each (table_destination_each, babl); - fprintf (output_file, "\n"); - source_no++; - return 0; -} - -/* copied from babl-fish-path.c */ -#define BABL_LEGAL_ERROR 0.000001 -static double legal_error (void) -{ - static double error = 0.0; - const char *env; - - if (error != 0.0) - return error; - - env = getenv ("BABL_TOLERANCE"); - if (env && env[0] != '\0') - error = babl_parse_double (env); - else - error = BABL_LEGAL_ERROR; - return error; -} - -static int -each_conv (Babl *babl, - void *data) -{ - double error, cost; - - if (BABL (babl->conversion.source)->class_type != BABL_FORMAT) - return 0; - - error = babl_conversion_error (&babl->conversion); - cost = babl_conversion_cost (&babl->conversion); - - if (error > legal_error ()) - { - fprintf (output_file, "
%s
", babl->instance.name); - fprintf (output_file, "
"); - } - else - { - fprintf (output_file, "
%s
", babl->instance.name); - } - fprintf (output_file, "error: %f cost: %4.0f processings: %i pixels: %li", error, cost, - babl->conversion.processings, babl->conversion.pixels); - fprintf (output_file, "
"); - - return 0; -} - -static void -conversions (void) -{ - fprintf (output_file, "

Conversions

\n"); - babl_conversion_class_for_each (each_conv, NULL); - fprintf (output_file, "
\n"); -} - - - -void -babl_fish_stats (FILE *file) -{ - output_file = file; - - table_sum_processings_calc (); - fprintf (output_file, - "\n" - "\n" - "\n" - "\n" - "BablFishPath introspection\n" - "\n" - "" - - "" - - - "\n"); - - fprintf (output_file, "\n"); - - fprintf (output_file, "

BablFishPath introspection

"); - fprintf (output_file, "

Instrumentation and pathlengths.

"); - - fprintf (output_file, "\n"); - - babl_format_class_for_each (table_source_each, NULL); - - fprintf (output_file, "
Source formatDestination formats
"); - - fprintf (output_file, "
\n"); - - conversions (); - - fprintf (output_file, "\n"); -} - diff --git a/babl/babl-internal.h b/babl/babl-internal.h index cde8fc3..992a770 100644 --- a/babl/babl-internal.h +++ b/babl/babl-internal.h @@ -84,7 +84,6 @@ long babl_fish_reference_process (const Babl *babl, Babl * babl_fish_reference (const Babl *source, const Babl *destination); Babl * babl_fish_simple (BablConversion *conversion); -void babl_fish_stats (FILE *file); Babl * babl_fish_path (const Babl *source, const Babl *destination); diff --git a/babl/babl.c b/babl/babl.c index caec6a6..2b53d68 100644 --- a/babl/babl.c +++ b/babl/babl.c @@ -165,18 +165,6 @@ babl_exit (void) babl_store_db (); #endif - if (getenv ("BABL_STATS")) - { - char logfile_name[] = "/tmp/babl-stats.html"; - FILE *logfile; - logfile = fopen (logfile_name, "w"); - if (logfile) - { - babl_fish_stats (logfile); - fclose (logfile); - } - } - babl_extension_deinit (); babl_free (babl_extension_db ());; babl_free (babl_fish_db ());; diff --git a/tests/Makefile.am b/tests/Makefile.am index 6e282af..f7cf1f7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -42,7 +42,6 @@ EXTRA_DIST=common.inc noinst_PROGRAMS = \ introspect \ babl_fish_path_fitness \ - babl_fish_path_dhtml \ babl-html-dump \ conversions \ formats \ diff --git a/tests/babl_fish_path_dhtml.c b/tests/babl_fish_path_dhtml.c deleted file mode 100644 index b9bcadf..0000000 --- a/tests/babl_fish_path_dhtml.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "config.h" -#include -#include "babl-internal.h" - -int main (void) -{ - babl_init (); - - babl_set_extender (babl_extension_quiet_log ()); - babl_fish_stats (stdout); - - babl_exit (); - - return 0; -} -- 2.30.2